Show:

Q timestamp Class

This tool makes a timestamp which is periodically updated. Initially shows time offsets in ' ago' manner. Later represents time depending on format, wisely excluding unnecessary detais (i.e. 'year' if timestamp has been made this year, 'year' and 'month if in this month etc).

Constructor

Q timestamp

(
  • [options]
  • [options.time=new
  • [options.format='{day-week}
)

Parameters:

  • [options] Object optional

    This is an object of parameters for this tool

    • [relative=true] Boolean optional

      Whether to show times relative to the current time when they are close to it

    • [countdown=true] Boolean optional

      Pass false to avoid displaying a countdown of seconds in the relative times

    • [capitalized=false] Boolean optional

      Whether to capitalize the displayed day name

      • time: the time of the day, based on the locale
      • time-day: same as time, but doesn't show on a different day
      • time-week: same as time, but doesn't after 7 days in the future or before 1 day in the past
      • day: the day's name, like "Sun", but can also be "last night", "yesterday", "tom morn", etc.
      • day-week: same as day, but doesn't show after 7 days in the future or before 1 day in the past
      • longday: the day's long name, like "Sunday", but can also be "last night", "yesterday", "tom morn", etc.
      • longday-week: same as longday, but doesn't show after 7 days in the future or before 1 day in the past
      • date: something like "Jan 04"
      • date+week: same as date but only shows after 7 days in the future or before 1 day in the past
      • year: four digit year such as 2017
      • year+year: same as year but only shows if different than current year
    • [beforeRefresh] Q.Event optional

      Return false from this event to cancel refresh

  • [options.time=new Number

    Date().getTime()/1000] Unix timestamp (in seconds).

  • [options.format='{day-week} String

    {date+week} {year+year} %l:%M %P'] formatting string which makes specific timestamp representation. Can contain placeholders supported by strftime() and also few special placeholders with specific functionality. Placeholders can include:

Item Index